<template>
  <div>
    <div class="d1">
      <p>父组件展示的：{{age}}</p>
    </div>
    <div class="d1">
      <Index></Index>
    </div>
  </div>
</template>

<script setup>
import { ref, provide } from 'vue';
import Index from '../../components/sanDianEr/provide和inject/index.vue'

let age = ref(0)
let changeAge = (cb) => {
  age.value = cb
}

provide('provideState', {
  age,
  changeAge
})


</script>
<style scoped lang ='less'>
.d1 {
  width: 80%;
  height: 100px;
  border: 1px solid #000;
  margin: 10px auto;
}
</style>